<?php
/**
 * Created by : Sandi Rizky Kharisma (sandi.informatics08@gmail.com)
 * This Class Generated for CRUD purpose only
 */
class order_barang extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();

        $this->load->library('auth');
        $this->load->library('base');
        $this->load->library('ajaxresponse');
        $this->load->library('datatables');
        $this->load->model('crud/m_order_barang');
    }


    public function get_all()
    {
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_order_barang->get()->result();
        echo json_encode($this->response);
    }

    public function get_non_realisasi()
    {
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_order_barang->get_non()->result();
        echo json_encode($this->response);
    }

    public function get($id)
    {
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_order_barang->get_one($id)->result_array();
        echo json_encode($this->response);
    }

    public function add_no_order($nomer_order)
    {
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_order_barang->insert($nomer_order);
        echo json_encode($this->response);
    }
  

    public function update($id)
    {
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_order_barang->update($id);
        echo json_encode($this->response);
    }

    function getID($nomer){
        $this->auth->is_logged_in('form/login');
        $this->response = new ajaxresponse();
        $this->response->data = $this->m_order_barang->get_id($nomer)->row()->ID_ORDER;
        echo json_encode($this->response);
    }

   
}
?>